package com.project.poetry.service.controller;

import com.project.poetry.service.entity.dto.progress.ContinueProgressDTO;
import com.project.poetry.service.entity.dto.progress.ProgressDTO;
import com.project.poetry.service.entity.po.user.UserPO;
import com.project.poetry.service.service.ProgressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

/**
 * 进度控制器
 * @author mengxj
 */
@Api("进度")
@RestController
@RequestMapping("progress")
public class ProgressController {

    @Resource
    private ProgressService progressService;

    @ApiOperation("保存游戏进度")
    @PostMapping("saveProgress")
    public void saveProgress(@RequestBody ProgressDTO progress){
        this.progressService.saveProgress(progress);
    }

    @ApiOperation("根据游戏进度继续游戏")
    @GetMapping("continueProgress/{relationId}")
    public ContinueProgressDTO continueProgress(@PathVariable Long relationId, @ApiIgnore UserPO user){
        return this.progressService.continueProgress(relationId, user);
    }
}
